
<?php
	session_start();
	include "db_function.php";
	$uid = intval($_SESSION['uid']);
	if($uid < 1){
		header("location: login.php");
		die;
	}elseif(isset($_POST['sub'])&& ($_POST['sub']=='发布主题帖')){
		$post_arr = array(
			"title"=>$_POST['title'],
			"content"=>$_POST['content'],
			"uid"=>$_SESSION['uid'],
			"crtime"=>date('Y-m-d H:i:s',time())
		);
		creat_post($post_arr);
		$pid=get_pid($uid);
		header("location:post.php?pid=$pid");
	}else{
		header("location:index.php");
	}
?>